﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace GameName1
{
    class ScreenManager
    {
        private static ScreenManager _instance;

        public ContentManager ContentManager { get; private set; }
        public Vector2 Resolution { get; private set; }
        
        public GameScene CurrentScreen { private get; set; }

        private ScreenManager()
        {
            Resolution = new Vector2(800,600);
            CurrentScreen = new MainMenuScene();
        }

        public static ScreenManager GetInstance()
        {
            if(_instance==null)
                _instance = new ScreenManager();
            
            return _instance;
        }

        public void LoadContent(ContentManager contentManager)
        {
            this.ContentManager = new ContentManager(contentManager.ServiceProvider, "Content");
            CurrentScreen.LoadContent();
        }

        public void UnloadContent()
        {
            CurrentScreen.UnloadContent();
        }

        public void Update(GameTime gameTime)
        {
            CurrentScreen.Update(gameTime);
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            CurrentScreen.Draw(spriteBatch);
        }

    }
}
